<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <script>
    class Person{
      constructor(name, age){
        this.name=name;
        this.age=age;
      }

      showName(){
        alert(this);
        alert('我叫'+this.name);
      }
      showAge(){
        alert('我'+this.age+'岁');
      }
    }




    let p=new Person('blue', 18);

    document.onclick=p.showName.bind(p);
    </script>
  </head>
  <body>

  </body>
</html>
